<?php
global $base_dir;
$base_dir='../../';

/**** 模块调用*****/
include_once($base_dir."inc/inc_connect.php");		//通用函数包含文件
include_once("index_inc.php");
include_once("func/function.php");
include_once($base_dir."inc/manage.php");			//后台通用包含文件
?>
<?php
//接收参数
if(is_array($_GET))
{
	foreach($_GET as $key => $value)
	{
		$$key=$value;
	}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?=$lanmu_name?>-后台管理系统</title>
<link href="../../style/common.css" rel="stylesheet" type="text/css" />
<script src="../../js/checkform.js" type="text/javascript"></script>
<script type="text/javascript">
//删除确认
function delConfig(url,str)
{
	if(confirm(str))
	{
		location.href=url;
	}
}
</script>
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="lanmu_table">
  <tr>
    <td height="30" valign="bottom"><a href="<?php echo isset($url_list) ? $url_list : "";?>">
    <span class="lanmu_title"><?php echo isset($lanmu_name) ? $lanmu_name : "";?></span>
</a>
<span class="lanmu_title2">&nbsp;&gt;&nbsp;列表</span></td>
  </tr>
</table>
<!--搜索部分
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="margintop30_l">
<form action="" method="get" name="search">
  <tr>
    <td height="30" class="search"><strong>搜索:&nbsp;</strong></td>
  </tr>
  </form>
</table>
-->
<?php
$pagesize=40;
$t=new Tbl_Act($tbl_name,$tbl_key);		//创建表对象
//$t->printsql=1;

//构建查询条件

$query_conv='where 1';

//搜索条件开始
// * sample 搜索字段dl_title，方式为模糊查询
$query_conv2[] = '';
if(isset($dl_title)){
	$t->$product_name=$product_name;
	$query_conv.=" and dl_title like '%$dl_title%'";
	$query_conv2[]='dl_title,like';					//这里两个条件代表的意思是一样的，第二种为数据库类需要的格式
}

//搜索条件结束

//计算记录数量
$rs_num=$t->RsCount($query_conv2);
$pages=ceil($rs_num/$pagesize);
$page = 0;
if($page>$pages)
{
	$page=$pages;
}
if($page<1)
{
	$page=1;
}
$sql_limit=" limit ".($page-1)*$pagesize.",$pagesize";
//$t->printsql=1;
$rows=$t->GetAll('*',$query_conv.' order by '.$tbl_key.' desc'.$sql_limit);		//排序方式在此设置
?>
<table border="0" cellpadding="0" cellspacing="1" bgcolor="#999999" class="margintop30_l">
  <tr>
  	<td width="80" height="25" align="center" class="title01">编号</td>
  	<td width="120" height="25" align="center" class="title01">城市名称</td>
  	<td width="100" height="25" align="center" class="title01">邮编</td>

    <td width="100" height="25" align="center" class="title01"><a href="<?=$url_add?>" style="color:#C23734">增加记录</a></td>
  </tr>
<?php
if(is_array($rows) && count($rows)>0)
{
	foreach($rows as $key => $row)
	{
		$td_id=$row[$tbl_key];
		$td_op='<a href="'.$url_mod.'?id='.$td_id.'">修改</a>&nbsp;&nbsp;<a href="javascript:delConfig(\''.$url_act.'?act=del&id='.$td_id.'\',\'确定删除？\')">删除</a>';
		$td0=$row["name"];
		$td1=$row["code"];

?>
  <tr>
    <td height="25" bgcolor="#FFFFFF" class="list_td"><?=$td_id?></td>
    <td height="25" bgcolor="#FFFFFF" class="list_td"><?=$td0?></td>
    <td height="25" bgcolor="#FFFFFF" class="list_td"><?=$td1?></td>

    <td height="25" align="center" bgcolor="#FFFFFF" class="list_td"><?=$td_op?></td>
  </tr>
<?php
	}
?>  
  <tr>
    <td height="25" colspan="4" align="right" bgcolor="#FFFFFF">
	<?php
	$helfstyle='?page=@';
	if(is_array($_GET))
	{
		foreach($_GET as $key => $value)
		{
			if($key=='page')
			{
				continue;
			}
			$helfstyle.='&'.$key.'='.$value;
		}
	}
	echo getPageNum($page,$pages,5,$helfstyle);
	?>
	&nbsp;</td>
  </tr>
  
<?php
}
else
{
?>
	<tr>
    	<td height="25" colspan="4" align="center" bgcolor="#FFFFFF">暂无内容&nbsp;...</td>
	</tr>
<?php
}
?>
</table>
</body>
</html>
<?php
include_once($base_dir."inc/inc_unconnect.php")
?>